<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>审核录入页面</title>

    <!--引入本地 element-ui 的样式，-->
    <link rel="stylesheet" href="/admin/plugin/element-ui/index.css">
    <script type="text/javascript" src="/admin/js-css/js/vue.min.js"></script>
    <script type="text/javascript" src="/admin/plugin/element-ui/index.js"></script>
    <script type="text/javascript" src="/admin/plugin/element-ui/httpVueLoader.js"></script>


    <!--    引入Layui组件-->
    <link rel="stylesheet" href="/admin/plugin/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css"  media="all">
    <script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>

    <script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/mx1.0.js?v=1.1.1"></script>
    <script type="text/javascript" src="/admin/html/module/yumenyoutian/js/api.js"></script>


</head>
<body>

    <div id="app" style="padding: 20px;">
        <el-input
                type="textarea"
                :rows="2"
                placeholder="请输入审核留言"
                v-model="tipMessage" >
        </el-input>


        <el-form size="mini" style="margin-top: 5px;" >
            <el-form-item v-for="(item,index) in msg">
                <el-radio v-model="tipMessage" :label="item.msg">
                    <el-input style="width: 300px;" v-model="msg[index].msg" ></el-input>
                    <el-button size="mini" type="primary" @click="save(item)" >保存</el-button>
                </el-radio>
            </el-form-item>
        </el-form>

    </div>

    <script>

        var vm = new Vue({
           el:"#app",
           data:{
               tipMessage:"同意",
               msg:[],
               user:{},
               parmsData : {},
           },
           created(){
               this.parmsData = getParams();
               let user = localStorage.getItem("user");
               this.user = JSON.parse(user);
               this.getT0();
           },
            methods:{
                async save(item){
                    const res = await updateMapdata(getTableId("0"),{id:item.id,msg:item.msg});
                    top.alert(res.msg);
                },
                async getT0(){//获取常用语句
                    let res = await listAdmin(getTableId("0"),"id desc",{});
                    this.msg = res.data;
                    if(res.data.length == 0){
                        await addMapdata(getTableId("0"),{msg:"同意","userid":this.user.id});
                        await addMapdata(getTableId("0"),{msg:"不同意","userid":this.user.id});
                        await addMapdata(getTableId("0"),{msg:"没有意见","userid":this.user.id});

                        res = await listAdmin(getTableId("0"),"id desc",{});
                        this.msg = res.data;
                    }
                },
            }
        });


        function getData(){
            return {ly:vm.tipMessage,id:vm.parmsData.id};
        }
    </script>
</body>
</html>